﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using br.com.SistemaChamados.Model;
using br.com.SistemaChamados.Enum;
using br.com.SistemaChamados.DAO;

namespace br.com.SistemaChamados.Controller
{
    public class CallCategoryController
    {

        public EnumGenericState InsertCallCategory(CallCategory callCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallCategoryDAO.InsertCallCategory(callCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public EnumGenericState UpdateCallCategory(CallCategory callCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallCategoryDAO.UpdateCallCategory(callCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public EnumGenericState DeleteCallCategory(CallCategory callCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallCategoryDAO.DeleteCallCategory(callCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public CallCategory GetCallCategory(CallCategory callCategory)
        {
            CallCategory ValidateCallCategorySelected = new CallCategory();
            try
            {
                ValidateCallCategorySelected = CallCategoryDAO.getCallCategory(callCategory);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ValidateCallCategorySelected;
        }

        public List<CallCategory> GetCallCategories()
        {
            List<CallCategory> Returnedlist = new List<CallCategory>();

            try
            {
                Returnedlist = CallCategoryDAO.getCallCategories();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Returnedlist;
        }

    }
}